package com.tanhua.server.service;

import com.tanhua.commons.utils.UserHolder;
import com.tanhua.dubbo.api.UserLocationApi;
import com.tanhua.model.domain.db.ErrorResult;
import com.tanhua.server.exceotion.BusinessException;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

/**
 * @author maorf
 * @version 1.0
 */
@Service
public class BaiduService {

    @DubboReference
    private UserLocationApi userLocationApi;

    //更新地理位置
    public void updateLocation(Double longitude, Double latitude, String address) {
        Boolean flag = userLocationApi.updateLocation(UserHolder.getUserId(),longitude,latitude,address);
        if(!flag) {
            throw  new BusinessException(ErrorResult.error());
        }
    }
}
